<%
creators = resource.asset.creators
(creators = creators + [resource.contributor.try(:person)]) unless (resource.class == Publication)
creators = creators.compact.uniq
creators_sorted_by_avatar = creators.sort_by{|p| p.person.avatar_id.nil? ? 1 : 0}
%>
<div class="asset_resource_avatars">
  
  <% unless creators.empty? -%>
    <% if creators.size <= 2 %>
      <% creators.each do |a|  -%>
        <%=  favouritable_icon(a, 60) -%>
      <% end -%>
    <% else %>
      <% creators_sorted_by_avatar[0...2].each do |a|  -%>
        <%=  favouritable_icon(a, 60) -%>
      <% end -%>
      <div id="authorAvatarList<%= resource.object_id -%>" class="avatar_list_popup" style="display:none;">
        <% creators.each do |a|  -%>
          <%=  favouritable_icon(a, 60) -%>
        <% end -%>
        <br/>
        <a href="#" onclick="toggleAuthorAvatarList(<%= resource.object_id-%>); return false;">[Close]</a>
      </div>
      <a href="#" id="authorAvatarListLink<%= resource.object_id -%>" onclick="toggleAuthorAvatarList(<%= resource.object_id-%>); return false;">(Show All)</a>
    <% end %>
  <% end %>
</div>